February 5, 2006
CK JAVA DEFENSIVE
PROGMONJavaCDefensive
NOTIFICATION OBJECTS JAVA  simulated in  ADA
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

-- dining philosophers paradigm. 
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

-- The chopsticks are allocated as many as available 
-- and the allocation is completed as soon as the missing chopsticks are released.
-- allocates two sticks if they are available
-- else allocate left stick if possible 
-- waits if both sticks have not been allocated
 
-- JAVA implementation with Notification objects
-- condition synchronisation provided by additional notification objects
-- Solution inspired by private semaphore schema

-- simulated with an Ada protected object 
--    which simulates Java concurrency semantics
-- the Java wait operation is here an entry call with a barrier
-- one Java synchronized method simulated by Get_LR and Wait

-- instrumented for concurrency denials ratio measurement

-- ********    reliable, deadlock free

************************************
Ordinateur-de-pacha:~ claudePB$ time ./diner*****   DINING PHILOSOPHERS WITH STICK ALLOCATION AS MANY AS AVAILABLE
*****   RELIABLE  JAVA NOTIFICATION OBJECTS SOLUTION : SIMULATED IN ADA
*****   WITH CONCURRENCY RATIO INSTRUMENTATION
 5 philosophers thinking 0.010000000 and eating 0.010000000
 and (when Java monitor semantics) requesting 0.000000000
                 CONCURRENCY MEASURES DISPLAY
 NbMealsAttended =   100000
 NbPairs :  40015
 NbRequestSingletons :  59985
 NbStructuralRefusals :  31940
 NbCautiousRefusals :  41761
 Total number of denials =   73701
      Total simulation time is    550.210605000
      Mean allocation time is     287.235952800
      Allocation ratio is         0.522047285
      Philosopher  0  remains hungry during  287.848525000
      Philosopher  1  remains hungry during  287.359417000
      Philosopher  2  remains hungry during  286.495496000
      Philosopher  3  remains hungry during  286.035311000
      Philosopher  4  remains hungry during  288.441015000

real    9m10.411s
user    0m13.590s
sys     0m5.410s


****************************************************

Ordinateur-de-pacha:~ claudePB$ time ./diner

*****   DINING PHILOSOPHERS WITH STICK ALLOCATION AS MANY AS AVAILABLE
*****   RELIABLE  JAVA NOTIFICATION OBJECTS SOLUTION : SIMULATED IN ADA
*****   WITH CONCURRENCY RATIO INSTRUMENTATION
 5 philosophers thinking 0.010000000 and eating 0.010000000
 and (when Java monitor semantics) requesting 0.000000000
                 CONCURRENCY MEASURES DISPLAY
 NbMealsAttended =   100000
 NbPairs :  41617
 NbRequestSingletons :  58383
 NbStructuralRefusals :  30770
 NbCautiousRefusals :  42088
 Total number of denials =   72858
      Total simulation time is    541.985852000
      Mean allocation time is     278.555690400
      Allocation ratio is         0.513953804
      Philosopher  0  remains hungry during  279.526529000
      Philosopher  1  remains hungry during  278.450989000
      Philosopher  2  remains hungry during  277.662520000
      Philosopher  3  remains hungry during  277.918673000
      Philosopher  4  remains hungry during  279.219741000

real    9m2.129s
user    0m12.760s
sys     0m5.790s


with reqestiong delay of one millisecond

Ordinateur-de-pacha:~ claudePB$ time ./diner*****   DINING PHILOSOPHERS WITH STICK ALLOCATION AS MANY AS AVAILABLE
*****   RELIABLE  JAVA NOTIFICATION OBJECTS SOLUTION : SIMULATED IN ADA
*****   WITH CONCURRENCY RATIO INSTRUMENTATION
 5 philosophers thinking 0.010000000 and eating 0.010000000
 and (when Java monitor semantics) requesting 0.001000000
                 CONCURRENCY MEASURES DISPLAY
 NbMealsAttended =   100000
 NbPairs :  25987
 NbRequestSingletons :  74013
 NbStructuralRefusals :  42046
 NbCautiousRefusals :  37241
 Total number of denials =   79287
      Total simulation time is    665.335333000
      Mean allocation time is     416.836514200
      Allocation ratio is         0.626505903
      Philosopher  0  remains hungry during  414.007163000
      Philosopher  1  remains hungry during  416.465586000
      Philosopher  2  remains hungry during  418.021382000
      Philosopher  3  remains hungry during  418.358150000
      Philosopher  4  remains hungry during  417.330290000

real    11m5.579s
user    0m17.010s
sys     0m8.180s
************************
Ordinateur-de-pacha:~ claudePB$ time ./diner

*****   DINING PHILOSOPHERS WITH STICK ALLOCATION AS MANY AS AVAILABLE
*****   RELIABLE  JAVA NOTIFICATION OBJECTS SOLUTION : SIMULATED IN ADA
*****   WITH CONCURRENCY RATIO INSTRUMENTATION
 5 philosophers thinking 0.010000000 and eating 0.010000000
 and (when Java monitor semantics) requesting 0.001000000
                 CONCURRENCY MEASURES DISPLAY
 NbMealsAttended =   100000
 NbPairs :  25899
 NbRequestSingletons :  74101
 NbStructuralRefusals :  41914
 NbCautiousRefusals :  37360
 Total number of denials =   79274
      Total simulation time is    668.018452000
      Mean allocation time is     418.340216000
      Allocation ratio is         0.626240509
      Philosopher  0  remains hungry during  417.728701000
      Philosopher  1  remains hungry during  419.024717000
      Philosopher  2  remains hungry during  418.843021000
      Philosopher  3  remains hungry during  416.422697000
      Philosopher  4  remains hungry during  419.681944000

real    11m8.235s
user    0m16.850s
sys     0m8.510s